#include<iostream>
using namespace std;

template<class T>
class stack
{
public:
	stack(int x = 4)
		:_a (new T[x])
		,_size (0)
		,_capacity(x)
		{}
	~stack()
	{
		delete[] _a;
		_size = _capacity = 0;
	}

	void push(T x)
	{
		
		_a[_size++] = x;
	}

	void pop()
	{
		_size--;
	}

	void print() const
	{
		cout << _a[_size-1] << endl;
	}

private:
	T* _a;
	int _size;
	int _capacity;
};

int main()
{
	stack<int> st1;
	stack<double> st2;

	st1.push(1);
	st1.print();
	st1.push(2);
	st1.print();
	st1.push(3);
	st1.print();


	return 0;
}